package com.mo.modular.search.job;

import java.util.Date;

import javax.annotation.Resource;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import com.mo.search.service.IWriteMixedService;
@Component
@EnableScheduling
public class SchedulerQuartzJob {

	@Value("${path.lucenePath}")
	private String lucenePath;
	@Resource
	private IWriteMixedService writeMixedService;
	
	@Scheduled(cron="${path.luceneCorn}")
    public void job(){
		Date startTime=new Date();
		System.out.println("创建索引开始---------------------当前时间为"+startTime+",索引文档为："+lucenePath);
		writeMixedService.updateAllMixedCont();
		
        Date endTime=new Date();
		System.out.println("创建索引结束---------------------当前时间为："+endTime+",总时长为："+(endTime.getTime()-startTime.getTime())+"毫秒");

    }

}

